var q = require('q');
var request = require('request').defaults({
    json: true
});
var config = require('./../config.json');
module.exports = {
    /** 获取布点图 */
    getLayer: function () {
        var _this = this;
        var defer = q.defer();
        request({
            url: config.apiUrl + '/getprojectlayers/',
            qs: {
                prjId: _this.prjId
            }
        }, function (error, response, body) {
            if (!error && response.statusCode === 200) {
                if (typeof (body) === 'string') {
                    body = JSON.parse(body);
                }
                defer.resolve(body);
            } else {
                defer.resolve([]);
            }
        });
        return defer.promise;
    }
}